package com.elvin.platform.webSocket;


import com.alibaba.fastjson.JSONObject;
import com.elvin.platform.webSocket.service.WebSocketServer;
import org.java_websocket.enums.ReadyState;
import org.springframework.beans.factory.annotation.Autowired;

import java.net.URI;

public class ClientStart {
  @Autowired
  WebSocketServer webSocketServer;
  public static void main(String[] args) {
    try {
      BaseWebsocketClient myClient = new BaseWebsocketClient(new URI("ws://localhost:8006/platform/api/pushMessage"));
      myClient.connect();
      while (!myClient.getReadyState().equals(ReadyState.OPEN)) {
        System.out.println("连接中。。。");
        Thread.sleep(1000);
      }
      JSONObject object = new JSONObject();
      object.put("message", "success连接");
      myClient.send("是我啊");
    }catch (Exception e){
      e.printStackTrace();
    }
  }


}


